import java.awt.BorderLayout;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.WindowConstants;

import java.awt.Dimension;
import javax.swing.JButton;
import java.awt.Rectangle;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import java.awt.Font;

public class trade6GUI extends JFrame {

	private static final long serialVersionUID = 1L;
	private JPanel jContentPane = null;
	private int CardNum;
	private JLabel jLabel = null;
	private JLabel jLabel1 = null;
	private JLabel jLabel2 = null;
	private JButton jButton = null;
	private JButton jButton1 = null;
	private JButton jButton2 = null;
	private JButton jButton3 = null;
	private int offer=0;
	private JButton jButton4 = null;
	private Players[] player;
	private Deeds[] deeds;
	private int playerchosen;
	private int playerturn;
	private JFrame frame;
	private JButton jButton6 = null;
	private JButton jButton5 = null;
	private JButton jButton61 = null;
	private JButton jButton62 = null;
	private PropertyEvent property;
	/**
	 * This is the default constructor
	 */
	public trade6GUI(PropertyEvent property, int CardNum,int playerchosen,int playerturn,Players[] player,Deeds[] deeds,JFrame frame) {
		super();
		this.property=property;
		this.CardNum=CardNum;
		this.playerchosen=playerchosen;
		this.playerturn=playerturn;
		this.player=player;
		this.deeds=deeds;
		this.frame=frame;
		initialize();
	}

	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		this.setSize(498, 332);
		this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE) ;
		this.setContentPane(getJContentPane());
		this.setTitle("JFrame");
		this.setVisible(true);
	}

	/**
	 * This method initializes jContentPane
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJContentPane() {
		if (jContentPane == null) {
			jLabel2 = new JLabel();
			jLabel2.setBounds(new Rectangle(217, 30, 265, 38));
			jLabel2.setFont(new Font("Dialog", Font.BOLD, 24));
			jLabel2.setText("Player"+playerchosen+" Make an offer");
			jLabel1 = new JLabel();
			jLabel1.setBounds(new Rectangle(243, 98, 125, 28));
			jLabel1.setFont(new Font("Dialog", Font.BOLD, 18));
			jLabel1.setText("0");
			jLabel = new JLabel();
			jLabel.setBounds(new Rectangle(16, 30, 175, 207));
			
		    if(this.CardNum==0){
		    	jLabel.setIcon(new ImageIcon(getClass().getResource("/Images/MedAve.JPG")));
			}
			if(this.CardNum==1){
			jLabel.setIcon(new ImageIcon(getClass().getResource("/Images/BalticAve.jpg")));
			}
			if(this.CardNum==2){
			jLabel.setIcon(new ImageIcon(getClass().getResource("/Images/RR.JPG")));
			}
			if(this.CardNum==3){
			jLabel.setIcon(new ImageIcon(getClass().getResource("/Images/Oriental.jpg")));
			}
			if(this.CardNum==4){
			jLabel.setIcon(new ImageIcon(getClass().getResource("/Images/Vermont.jpg")));
			}
			if(this.CardNum==5){
			jLabel.setIcon(new ImageIcon(getClass().getResource("/Images/Conn.jpg")));
			}
			if(this.CardNum==6){
			jLabel.setIcon(new ImageIcon(getClass().getResource("/Images/Charlse.JPG")));
			}
			if(this.CardNum==7){
			jLabel.setIcon(new ImageIcon(getClass().getResource("/Images/Electric.jpg")));
			}
			if(this.CardNum==8){
			jLabel.setIcon(new ImageIcon(getClass().getResource("/Images/StatesAve.jpg")));
			}
			if(this.CardNum==9){
			jLabel.setIcon(new ImageIcon(getClass().getResource("/Images/Virginia.jpg")));
			}
			if(this.CardNum==10){
			jLabel.setIcon(new ImageIcon(getClass().getResource("/Images/PensRR.jpg")));
			}
			if(this.CardNum==11){
			jLabel.setIcon(new ImageIcon(getClass().getResource("/Images/James.jpg")));
			}
			if(this.CardNum==12){
			jLabel.setIcon(new ImageIcon(getClass().getResource("/Images/Tennesee.jpg")));
			}
			if(this.CardNum==13){
			jLabel.setIcon(new ImageIcon(getClass().getResource("/Images/NewYork.jpg")));
			}
			if(this.CardNum==14){
			jLabel.setIcon(new ImageIcon(getClass().getResource("/Images/Kentucky.jpg")));
			}
			if(this.CardNum==15){
			jLabel.setIcon(new ImageIcon(getClass().getResource("/Images/Indiana.JPG")));
			}
			if(this.CardNum==16){
			jLabel.setIcon(new ImageIcon(getClass().getResource("/Images/Illinois.jpg")));
			}
			if(this.CardNum==17){
			jLabel.setIcon(new ImageIcon(getClass().getResource("/Images/BO.jpg")));
			}
			if(this.CardNum==18){
			jLabel.setIcon(new ImageIcon(getClass().getResource("/Images/Atlantic.jpg")));
			}
			if(this.CardNum==19){
			jLabel.setIcon(new ImageIcon(getClass().getResource("/Images/Ventor.jpg")));
			}
			if(this.CardNum==20){
			jLabel.setIcon(new ImageIcon(getClass().getResource("/Images/WW.jpg")));
			}
			if(this.CardNum==21){
			jLabel.setIcon(new ImageIcon(getClass().getResource("/Images/MarvinGardens.JPG")));
			}
			if(this.CardNum==22){
			jLabel.setIcon(new ImageIcon(getClass().getResource("/Images/Pacific.jpg")));
			}
			if(this.CardNum==23){
			jLabel.setIcon(new ImageIcon(getClass().getResource("/Images/Nth.jpg")));
			}
			if(this.CardNum==24){
			jLabel.setIcon(new ImageIcon(getClass().getResource("/Images/Pens.jpg")));
			}
			if(this.CardNum==25){
			jLabel.setIcon(new ImageIcon(getClass().getResource("/Images/ShortLine.jpg")));
			}
			if(this.CardNum==26){
			jLabel.setIcon(new ImageIcon(getClass().getResource("/Images/ParkPlace.jpg")));
			}
			if(this.CardNum==27){
			jLabel.setIcon(new ImageIcon(getClass().getResource("/Images/BoardWalk.jpg")));
			}
			
			
			jLabel.setText("");
			jContentPane = new JPanel();
			jContentPane.setLayout(null);
			jContentPane.add(jLabel, null);
			jContentPane.add(jLabel1, null);
			jContentPane.add(jLabel2, null);
			jContentPane.add(getJButton(), null);
			jContentPane.add(getJButton1(), null);
			jContentPane.add(getJButton2(), null);
			jContentPane.add(getJButton3(), null);
			jContentPane.add(getJButton4(), null);
			jContentPane.add(getJButton5(), null);
			jContentPane.add(getJButton61(), null);
			jContentPane.add(getJButton62(), null);
		}
		return jContentPane;
	}

	/**
	 * This method initializes jButton	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButton() {
		if (jButton == null) {
			jButton = new JButton();
			jButton.setBounds(new Rectangle(242, 192, 58, 42));
			jButton.setText("+1");
			jButton.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					offer=offer+1;
					if(player[playerchosen-1].getMoney()>=offer){
					jLabel1.setText(""+offer);
					}else{
						offer=offer-1;
					}
					
				}
			});
	
		}
		return jButton;
	}

	/**
	 * This method initializes jButton1	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButton1() {
		if (jButton1 == null) {
			jButton1 = new JButton();
			jButton1.setBounds(new Rectangle(396, 192, 58, 42));
			jButton1.setText("+50");
			jButton1.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					offer=offer+50;
					if(player[playerchosen-1].getMoney()>=offer){
					jLabel1.setText(""+offer);
					}else{
						offer=offer-50;
					}
				}
			});
		}
		return jButton1;
	}

	/**
	 * This method initializes jButton2	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButton2() {
		if (jButton2 == null) {
			jButton2 = new JButton();
			jButton2.setBounds(new Rectangle(319, 192, 58, 42));
			jButton2.setText("+5");
			jButton2.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					offer=offer+5;
					if(player[playerchosen-1].getMoney()>=offer){
					jLabel1.setText(""+offer);
					}else{
						offer=offer-5;
					}
				}
			});
		}
		return jButton2;
	}

	/**
	 * This method initializes jButton3	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButton3() {
		if (jButton3 == null) {
			jButton3 = new JButton();
			jButton3.setBounds(new Rectangle(350, 245, 109, 44));
			jButton3.setText("cancel trade");
			jButton3.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					frame.setEnabled(true);
					setVisible(false);
				}
			});
		}
		return jButton3;
	}

	/**
	 * This method initializes jButton4	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButton4() {
		if (jButton4 == null) {
			jButton4 = new JButton();
			jButton4.setBounds(new Rectangle(238, 245, 108, 43));
			jButton4.setText("offer");
			jButton4.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					setVisible(false);
					trade7GUI gui = new trade7GUI(property,offer,CardNum,playerchosen,playerturn,player,deeds,frame);
					
				}
			});
		}
		return jButton4;
	}

	/**
	 * This method initializes jButton5	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButton5() {
		if (jButton5 == null) {
			jButton5 = new JButton();
			jButton5.setBounds(new Rectangle(242, 142, 56, 40));
			jButton5.setText("-1");
			jButton5.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					if(offer>=1){
					offer=offer-1;
					}
					jLabel1.setText(""+offer);
				}
			});
		}
		return jButton5;
	}

	/**
	 * This method initializes jButton61	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButton61() {
		if (jButton61 == null) {
			jButton61 = new JButton();
			jButton61.setBounds(new Rectangle(318, 142, 56, 37));
			jButton61.setText("-5");
			jButton61.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					if(offer>=5){
						offer=offer-5;
						}
					jLabel1.setText(""+offer);
				}
			});
		}
		return jButton61;
	}

	/**
	 * This method initializes jButton62	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButton62() {
		if (jButton62 == null) {
			jButton62 = new JButton();
			jButton62.setBounds(new Rectangle(398, 142, 55, 37));
			jButton62.setText("-50");
			jButton62.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					if(offer>=50){
						offer=offer-50;
						}
					jLabel1.setText(""+offer);
				}
			});
		}
		return jButton62;
	}

}  //  @jve:decl-index=0:visual-constraint="12,6"
